/**
 * 
 */
package com.zznode.client.wlanpolling.model;

import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.zznode.client.wlanpolling.R;

/**
 * 
 *
 */
public class HotspotInfo extends GeneralInfo {
	
	public String HOTSPOT_ID;
	public String HOT_CITYCODE;
	public String HOT_NAME;
	public String HOT_NUMBER;
	public String HOT_CODENO;
	public String HOT_ADDRESS;
	public String HOT_TYPE;
	public String HOT_CLASS;
	public String HOT_LONGITUDE;
	public String HOT_LATITUDE;
	public String HOT_DETAIL_ADDRESS;
	public String HOT_COVER;
	public String HOT_LANDMARK;
	public String HOT_IPADDRESS;
	public String HOT_TIME;
	public String HOTSPOT_TEL;
	
	public double REAL_LNG, REAL_LAT;
	
	@Override
	public String getGroupName() {
		return "热点信息：";
	}
	@Override
	public int getLayoutID() {
		return R.layout.hotspotinfo;
	}
	@Override
	public int getRootID() {
		return R.id.hotinfo;
	}
	@Override
	public void bind(View root) {
		TextView tv = null;
		EditText et = null;
		Button btn = null;
		
		tv = (TextView)root.findViewById(R.id.hot_id);
		tv.setText(HOTSPOT_ID);
		tv = (TextView)root.findViewById(R.id.hot_name);
		tv.setText(HOT_NAME);
		tv = (TextView)root.findViewById(R.id.hot_type);
		tv.setText(HOT_TYPE);
		tv = (TextView)root.findViewById(R.id.hot_detailtype);
		tv.setText(HOT_CLASS);
		
		final EditText et2 = (EditText)root.findViewById(R.id.hot_lng);
		et2.setText(HOT_LONGITUDE);
		addTextChangeListener(et2, "HOT_LONGITUDE");
		btn = (Button)root.findViewById(R.id.hot_replacelng);
		btn.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				et2.setText("" + REAL_LNG);
			}
			
		});
		tv = (TextView)root.findViewById(R.id.hot_real_lng);
		tv.setText("" + REAL_LNG);
		
		final EditText et3 = (EditText)root.findViewById(R.id.hot_lat);
		et3.setText(HOT_LATITUDE);
		addTextChangeListener(et3, "HOT_LATITUDE");
		btn = (Button)root.findViewById(R.id.hot_replacelat);
		btn.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				et3.setText("" + REAL_LAT);
			}
			
		});
		tv = (TextView)root.findViewById(R.id.hot_real_lat);
		tv.setText("" + REAL_LAT);		
		
		et = (EditText)root.findViewById(R.id.hot_address);
		et.setText(HOT_ADDRESS);
		addTextChangeListener(et, "HOT_ADDRESS");
		et = (EditText)root.findViewById(R.id.hot_coverarea);
		et.setText(HOT_COVER);
		addTextChangeListener(et, "HOT_COVER");
		et = (EditText)root.findViewById(R.id.hot_locflag);
		et.setText(HOT_LANDMARK);
		addTextChangeListener(et, "HOT_LANDMARK");
		et = (EditText)root.findViewById(R.id.hot_iprange);
		et.setMaxWidth(50);
		et.setHorizontallyScrolling(false);
		et.setText(HOT_IPADDRESS);
		et.requestLayout();
		addTextChangeListener(et, "HOT_IPADDRESS");
		tv = (TextView)root.findViewById(R.id.hot_workperiod);
		tv.setText(HOT_TIME);
//		addTextChangeListener(et, "HOT_TIME");
		
//		et = (EditText)root.findViewById(R.id.hot_vlan);
//		et.setText(HOT_VLAN);
//		addTextChangeListener(et, "HOT_VLAN");
		et = (EditText)root.findViewById(R.id.hot_phone);
		et.setText(HOTSPOT_TEL);
		addTextChangeListener(et, "HOTSPOT_TEL");
	}
	
}
